Network Icon

Examples de script

Thinking Home marche parfaitement avec AppleScript avec un dictionnaire complet, que vous pouvez parcourir avec un éditeur de script. Ce qui n'est pas visible dans le dictionnaire, c'est que vous pouvez faire référence aux appareils avec des méthodes alternatives. Par exemple, les ordres “turn on” ci-dessous sont tous équivalents.

Voici quelques exemples d'AppleScript dans Thinking Home.

Faire référence à un appareil

-- Vous pouvez manipuler les appareils comme il vous plait
tell application "Thinking Home"
turn on the "Porch Light"
turn on "P16"
turn on device "Porch Light"
turn on device 3
end tell

tell the "Porch Light" of application "Thinking Home"
turn on
end tell

tell application "Thinking Home"
tell the "Porch Light"
turn on
end tell
end tell

Diminuer
& Augmenter l'intensité

-- Diminuer et augmenter l'intensité des lampes est aussi facile.
tell application "Thinking Home"
dim the "Porch Light"-- default is by 35%
brighten the "Porch Light" by 80 -- percent
dim the "Porch Light" to 20 -- percent
end tell

Levé
& couché du soleil

tell application "Thinking Home"
set mySunUp to the sunrise for the current date
set mySundown to the sunset for the current date
end tell